Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparations for V8 11.x #1779

Merged
merged 3 commits into from
Sep 22, 2023
Merged

Preparations for V8 11.x #1779

merged 3 commits into from
Sep 22, 2023

Conversation

ptomato
Copy link
Contributor

@ptomato ptomato commented Aug 24, 2023

Description

This PR contains a few updates that will be required for V8 11.x but should be harmless to apply before the migration. (It should not be very risky to apply them to main, as well.)

  • Switch from CreationContext to GetCreationContextChecked: the CreationContext API goes away in 11.x, but the replacement already exists in 10.x, so we can go ahead and use it.
  • Set V8 flags before initializing V8: setting the flags after initialization will crash in 11.x. In 10.x the flags can be set either before or after.
  • Use CPPGC-compatible platform: we'll be migrating ObjectManager to use CPPGC, which requires changing the V8 Platform to use the CPPGC default platform. This already works fine in 10.x and should be harmless.

More details in the individual commit messages.

Does your pull request have unit tests?

No tests. The PR doesn't introduce any new functionality so the existing tests should all continue passing.

ptomato and others added 2 commits August 24, 2023 14:34
See v8/v8@b38bf5b0. The creation context may be
null for WASM objects, so the old API is deprecated in favour of
GetCreationContext() which returns a MaybeLocal<Context>. However, we are
not handling any WASM objects here, so we can use the version of the API
that asserts that we do have a creation context.
In 11.x, it's no longer allowed to change the flags after V8 has been
initialized.

We can also avoid storing the string in Constants::V8_STARTUP_FLAGS, as
it's no longer used anywhere else in the code base.
@cla-bot cla-bot bot added the cla: yes label Aug 24, 2023
For the CPPGC port we'll need to use a cppgc::DefaultPlatform instead of
the v8::platform::NewDefaultPlatform(). It's also harmless to use it
already even if we don't use CPPGC yet.
@edusperoni edusperoni merged commit 1da716d into NativeScript:v8-v11 Sep 22, 2023
3 checks passed
@ptomato ptomato deleted the 11.x-prep branch September 22, 2023 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants